/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Ventana.java
 *
 * Created on 31/05/2014, 12:27:47
 */
package TP6;

import javax.swing.JOptionPane;

/**
 *
 * @author augusto
 */
public class Ventana extends javax.swing.JFrame {

    private TableModel_Vector modelo;
    private VectorEstado vector;
    private Simulador simu;
    private int nroSimulacion = 0;
    private TableModel_Clientes clientes;
    int cantPersonas, cantSeFueron, cantsinGaseosaDeseada;
    int cantReposiciones, cantCambiosA, cantCambiosB, cantCambiosC;

    /** Creates new form Ventana */
    public Ventana() {
        initComponents();

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        txt_MinutosASimular = new javax.swing.JTextField();
        txt_MinutosDesde = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        txt_CantSimulaciones = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        txt_MinutosHasta = new javax.swing.JTextField();
        txt_SimulacionAMostrar = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        btn_Simular = new javax.swing.JButton();
        lbl_simulacion = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tabla = new javax.swing.JTable();
        jScrollPane2 = new javax.swing.JScrollPane();
        tabla_clientes = new javax.swing.JTable();
        lbl_simulacion1 = new javax.swing.JLabel();
        lbl_simulacion2 = new javax.swing.JLabel();
        lbl_simulacion3 = new javax.swing.JLabel();
        txt_ProbCambiarStockA = new javax.swing.JTextField();
        txt_ProbCambiarStockB = new javax.swing.JTextField();
        lbl_simulacion4 = new javax.swing.JLabel();
        txt_ProbCambiarStockC = new javax.swing.JTextField();
        lbl_simulacion5 = new javax.swing.JLabel();
        txt_ProbNoEncotrarGaseosaDeseada = new javax.swing.JTextField();
        lbl_simulacion6 = new javax.swing.JLabel();
        txt_ProbIrseSinGaseosa = new javax.swing.JTextField();
        lbl_simulacion7 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        txt_minimoAtencionCliente = new javax.swing.JTextField();
        txt_maximoAtencionCliente = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        txt_maximoLLegadaRepositor = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        txt_minimoLLegadaRepositor = new javax.swing.JTextField();
        btn_minimoAtencionCliente = new javax.swing.JButton();
        btn_maximoAtencionCliente = new javax.swing.JButton();
        btn_minimoLlegadaRepositor = new javax.swing.JButton();
        btn_maximoLlegadaRepositor = new javax.swing.JButton();
        btn_maximoLlegadaCliente = new javax.swing.JButton();
        btn_minimoLlegadaCliente = new javax.swing.JButton();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        txt_minimoLLegadaCliente = new javax.swing.JTextField();
        txt_maximoLLegadaCliente = new javax.swing.JTextField();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel4.setText("Cantidad de minutos a simular:");

        jLabel3.setText("Minuto desde: ");

        jLabel2.setText("Cantidad de Simulaciones:");

        jLabel1.setText("Minuto hasta:");

        jLabel5.setText("Simulación a mostrar:");

        btn_Simular.setText("Simular");
        btn_Simular.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_SimularActionPerformed(evt);
            }
        });

        lbl_simulacion.setText("Nro Simulacion");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel4)
                            .addComponent(jLabel2)
                            .addComponent(jLabel1)
                            .addComponent(jLabel3)
                            .addComponent(jLabel5))
                        .addGap(75, 75, 75)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txt_MinutosDesde, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(txt_SimulacionAMostrar, javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(txt_MinutosASimular, javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(txt_MinutosHasta, javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txt_CantSimulaciones, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(btn_Simular)
                        .addGap(18, 18, 18)
                        .addComponent(lbl_simulacion)))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel4)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(txt_MinutosASimular, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txt_MinutosDesde, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel3))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txt_MinutosHasta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel1))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txt_CantSimulaciones, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel2))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txt_SimulacionAMostrar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btn_Simular)
                    .addComponent(lbl_simulacion)))
        );

        tabla.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {},
                {},
                {},
                {}
            },
            new String [] {

            }
        ));
        tabla.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
        jScrollPane1.setViewportView(tabla);

        tabla_clientes.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {},
                {},
                {},
                {}
            },
            new String [] {

            }
        ));
        jScrollPane2.setViewportView(tabla_clientes);

        lbl_simulacion1.setText("Clientes:");

        lbl_simulacion2.setText("Respuestas:");

        lbl_simulacion3.setText("Probabilidad de Cambiar Stock de A");

        lbl_simulacion4.setText("Probabilidad de Cambiar Stock de B");

        lbl_simulacion5.setText("Probabilidad de Cambiar Stock de C");

        lbl_simulacion6.setText("Probabilidad de no encontrar gaseosa deseada");

        lbl_simulacion7.setText("Probabilidad de irse sin gaseosa");

        jLabel6.setText("tiempo minimo de atencion Cliente:");

        txt_minimoAtencionCliente.setText("2.5");

        txt_maximoAtencionCliente.setText("3.5");

        jLabel7.setText("Tiempo maximo de antencion Cliente:");

        txt_maximoLLegadaRepositor.setText("780");

        jLabel8.setText("Tiempo maximo de llegada Repositor:");

        jLabel9.setText("Tiempo minimo de llegada Repositor:");

        txt_minimoLLegadaRepositor.setText("660");

        btn_minimoAtencionCliente.setText("Cambiar");
        btn_minimoAtencionCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_minimoAtencionClienteActionPerformed(evt);
            }
        });

        btn_maximoAtencionCliente.setText("Cambiar");
        btn_maximoAtencionCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_maximoAtencionClienteActionPerformed(evt);
            }
        });

        btn_minimoLlegadaRepositor.setText("Cambiar");
        btn_minimoLlegadaRepositor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_minimoLlegadaRepositorActionPerformed(evt);
            }
        });

        btn_maximoLlegadaRepositor.setText("Cambiar");
        btn_maximoLlegadaRepositor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_maximoLlegadaRepositorActionPerformed(evt);
            }
        });

        btn_maximoLlegadaCliente.setText("Cambiar");
        btn_maximoLlegadaCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_maximoLlegadaClienteActionPerformed(evt);
            }
        });

        btn_minimoLlegadaCliente.setText("Cambiar");
        btn_minimoLlegadaCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_minimoLlegadaClienteActionPerformed(evt);
            }
        });

        jLabel10.setText("Tiempo maximo de llegada Cliente:");

        jLabel11.setText("Tiempo minimo de llegada Cliente:");

        txt_minimoLLegadaCliente.setText("0.5");

        txt_maximoLLegadaCliente.setText("3.5");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel9)
                            .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(69, 69, 69)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txt_minimoLLegadaRepositor, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(txt_minimoAtencionCliente)
                            .addComponent(txt_maximoAtencionCliente, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(btn_minimoAtencionCliente, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btn_maximoAtencionCliente, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btn_minimoLlegadaRepositor, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel8)
                            .addComponent(jLabel10)
                            .addComponent(jLabel11))
                        .addGap(75, 75, 75)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                                .addComponent(txt_minimoLLegadaCliente)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(btn_minimoLlegadaCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                                .addComponent(txt_maximoLLegadaCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(btn_maximoLlegadaCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                                .addComponent(txt_maximoLLegadaRepositor)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(btn_maximoLlegadaRepositor, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txt_minimoAtencionCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(btn_minimoAtencionCliente))
                    .addComponent(jLabel6))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txt_maximoAtencionCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7)
                    .addComponent(btn_maximoAtencionCliente))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(btn_minimoLlegadaRepositor)
                    .addComponent(txt_minimoLLegadaRepositor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txt_maximoLLegadaRepositor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8)
                    .addComponent(btn_maximoLlegadaRepositor))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txt_minimoLLegadaCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel11)
                    .addComponent(btn_minimoLlegadaCliente))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(btn_maximoLlegadaCliente)
                    .addComponent(txt_maximoLLegadaCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jMenu1.setText("Configuracion");
        jMenu1.add(jMenuItem1);

        jMenuBar1.add(jMenu1);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbl_simulacion1)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 347, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lbl_simulacion5)
                            .addComponent(lbl_simulacion3)
                            .addComponent(lbl_simulacion4)
                            .addComponent(txt_ProbCambiarStockA, javax.swing.GroupLayout.PREFERRED_SIZE, 191, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txt_ProbCambiarStockB, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lbl_simulacion6)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(txt_ProbIrseSinGaseosa, javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(txt_ProbNoEncotrarGaseosaDeseada, javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(lbl_simulacion7, javax.swing.GroupLayout.Alignment.LEADING))))
                    .addComponent(lbl_simulacion2)
                    .addComponent(txt_ProbCambiarStockC, javax.swing.GroupLayout.PREFERRED_SIZE, 187, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 305, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(lbl_simulacion1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane2, 0, 0, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(lbl_simulacion2)
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(lbl_simulacion6)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txt_ProbNoEncotrarGaseosaDeseada, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(lbl_simulacion7)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txt_ProbIrseSinGaseosa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(lbl_simulacion3)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txt_ProbCambiarStockA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(lbl_simulacion4)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txt_ProbCambiarStockB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(lbl_simulacion5)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txt_ProbCambiarStockC, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btn_SimularActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_SimularActionPerformed

        if (validarForm()) {

            llenarModelos();

        } else {
            JOptionPane.showMessageDialog(this, "Formulario llenado incorrecto ");
        }

    }//GEN-LAST:event_btn_SimularActionPerformed

    private void btn_minimoAtencionClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_minimoAtencionClienteActionPerformed
        double minimo=0.0;
        try {
            minimo = Double.parseDouble(txt_minimoAtencionCliente.getText());
        } catch (NumberFormatException ex) {

            JOptionPane.showMessageDialog(this, "Ingresar solo numeros, usar el punto como coma flotante");
        }
        if (minimo > 0) {
            Simulador.setAtencionClienteMinimo(minimo);
                  
        }
    }//GEN-LAST:event_btn_minimoAtencionClienteActionPerformed

    private void btn_maximoAtencionClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_maximoAtencionClienteActionPerformed
double maximo=0.0;
        try {
            maximo = Double.parseDouble(txt_maximoAtencionCliente.getText());
        } catch (NumberFormatException ex) {

            JOptionPane.showMessageDialog(this, "Ingresar solo numeros, usar el punto como coma flotante");
        }
        if (maximo > 0) {
            Simulador.setAtencionClienteMaximo(maximo);
                  
        }        
    }//GEN-LAST:event_btn_maximoAtencionClienteActionPerformed

    private void btn_minimoLlegadaRepositorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_minimoLlegadaRepositorActionPerformed
        double minimo=0.0;
        try {
            minimo = Double.parseDouble(txt_minimoLLegadaRepositor.getText());
        } catch (NumberFormatException ex) {

            JOptionPane.showMessageDialog(this, "Ingresar solo numeros, usar el punto como coma flotante");
        }
        if (minimo > 0) {
            simu.setLlegadaRepositorMinima(minimo);
                  
        }
        
    }//GEN-LAST:event_btn_minimoLlegadaRepositorActionPerformed

    private void btn_maximoLlegadaRepositorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_maximoLlegadaRepositorActionPerformed
    double maximo=0.0;
        try {
            maximo = Double.parseDouble(txt_maximoLLegadaRepositor.getText());
        } catch (NumberFormatException ex) {

            JOptionPane.showMessageDialog(this, "Ingresar solo numeros, usar el punto como coma flotante");
        }
        if (maximo > 0) {
            simu.setLlegadaRepositorMaxima(maximo);
                  
        }
    }//GEN-LAST:event_btn_maximoLlegadaRepositorActionPerformed

    private void btn_maximoLlegadaClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_maximoLlegadaClienteActionPerformed
        double maximo=0.0;
        try {
            maximo = Double.parseDouble(txt_maximoLLegadaCliente.getText());
        } catch (NumberFormatException ex) {

            JOptionPane.showMessageDialog(this, "Ingresar solo numeros, usar el punto como coma flotante");
        }
        if (maximo > 0) {
            simu.setLlegadaClienteMaximo(maximo);
                  
        }
    }//GEN-LAST:event_btn_maximoLlegadaClienteActionPerformed

    private void btn_minimoLlegadaClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_minimoLlegadaClienteActionPerformed
         double minimo=0.0;
        try {
            minimo = Double.parseDouble(txt_minimoLLegadaCliente.getText());
        } catch (NumberFormatException ex) {

            JOptionPane.showMessageDialog(this, "Ingresar solo numeros, usar el punto como coma flotante");
        }
        if (minimo > 0) {
            simu.setLlegadaClienteMinimo(minimo);
                  
        }
        
    }//GEN-LAST:event_btn_minimoLlegadaClienteActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Ventana().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btn_Simular;
    private javax.swing.JButton btn_maximoAtencionCliente;
    private javax.swing.JButton btn_maximoLlegadaCliente;
    private javax.swing.JButton btn_maximoLlegadaRepositor;
    private javax.swing.JButton btn_minimoAtencionCliente;
    private javax.swing.JButton btn_minimoLlegadaCliente;
    private javax.swing.JButton btn_minimoLlegadaRepositor;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JLabel lbl_simulacion;
    private javax.swing.JLabel lbl_simulacion1;
    private javax.swing.JLabel lbl_simulacion2;
    private javax.swing.JLabel lbl_simulacion3;
    private javax.swing.JLabel lbl_simulacion4;
    private javax.swing.JLabel lbl_simulacion5;
    private javax.swing.JLabel lbl_simulacion6;
    private javax.swing.JLabel lbl_simulacion7;
    private javax.swing.JTable tabla;
    private javax.swing.JTable tabla_clientes;
    private javax.swing.JTextField txt_CantSimulaciones;
    private javax.swing.JTextField txt_MinutosASimular;
    private javax.swing.JTextField txt_MinutosDesde;
    private javax.swing.JTextField txt_MinutosHasta;
    private javax.swing.JTextField txt_ProbCambiarStockA;
    private javax.swing.JTextField txt_ProbCambiarStockB;
    private javax.swing.JTextField txt_ProbCambiarStockC;
    private javax.swing.JTextField txt_ProbIrseSinGaseosa;
    private javax.swing.JTextField txt_ProbNoEncotrarGaseosaDeseada;
    private javax.swing.JTextField txt_SimulacionAMostrar;
    private javax.swing.JTextField txt_maximoAtencionCliente;
    private javax.swing.JTextField txt_maximoLLegadaCliente;
    private javax.swing.JTextField txt_maximoLLegadaRepositor;
    private javax.swing.JTextField txt_minimoAtencionCliente;
    private javax.swing.JTextField txt_minimoLLegadaCliente;
    private javax.swing.JTextField txt_minimoLLegadaRepositor;
    // End of variables declaration//GEN-END:variables

    private boolean validarForm() {

        boolean validado = true;
        int cantSimulaciones = 0, minutosASimular = 0, minutosDesde = 0, minutosHasta = 0, simulacionAMostrar;
        try {
            cantSimulaciones = Integer.parseInt(txt_CantSimulaciones.getText());
            minutosASimular = Integer.parseInt(txt_MinutosASimular.getText());
            minutosDesde = Integer.parseInt(txt_MinutosDesde.getText());
            minutosHasta = Integer.parseInt(txt_MinutosHasta.getText());
            simulacionAMostrar = Integer.parseInt(txt_SimulacionAMostrar.getText());

        } catch (NumberFormatException ex) {
            JOptionPane.showMessageDialog(this, "Debe ingresar todos numeros enteros");
        }

        if (cantSimulaciones <= 0) {
            validado = false;
        }
        if (minutosASimular <= 0) {
            validado = false;
        }
        if (minutosHasta <= minutosDesde || minutosHasta > minutosASimular) {
            validado = false;
        }
        if (minutosDesde < 0) {
            validado = false;
        }

        return validado;
    }

    private void llenarModelos() {
        int cantidadSimulaciones = Integer.parseInt(txt_CantSimulaciones.getText());
        double minutosDesde = Double.parseDouble(txt_MinutosDesde.getText());
        double minutosHasta = Double.parseDouble(txt_MinutosHasta.getText());
        double minutosASimular = Double.parseDouble(txt_MinutosASimular.getText());
        int simulacionAMostrar = Integer.parseInt(txt_SimulacionAMostrar.getText());
        simu = new Simulador(minutosASimular);
        modelo = new TableModel_Vector();
        clientes = new TableModel_Clientes();

        for (int i = 0; i < cantidadSimulaciones; i++) {
            if (simulacionAMostrar == (i + 1)) {
                modelo.cargarData(simu.simular(minutosDesde, minutosHasta));
                clientes.llenarModelo(simu.obtenerClientes());
                cargarDatosSimulacion(simu.datosSimulacion());
            } else {
                simu.simular(minutosDesde, minutosHasta);
                cargarDatosSimulacion(simu.datosSimulacion());
            }

        }
        nroSimulacion = simulacionAMostrar;
        cargarTabla();


    }

    private void cargarTabla() {
        tabla.setModel(modelo);
        tabla_clientes.setModel(clientes);
        lbl_simulacion.setText("Simulación Nro " + nroSimulacion);
        // llena los resultados de todas las simulaciones
        mostrarDatosSimulacion();
    }

    private void cargarDatosSimulacion(int[] datos) {
        cantPersonas = +datos[0];
        cantSeFueron = +datos[1];
        cantsinGaseosaDeseada = +datos[2];
        cantReposiciones = +datos[3];
        cantCambiosA = +datos[4];
        cantCambiosB = +datos[5];
        cantCambiosC = +datos[6];




    }

    private void mostrarDatosSimulacion() {
        if (cantReposiciones != 0) {

            txt_ProbCambiarStockA.setText((double) cantCambiosA / cantReposiciones + "");
            txt_ProbCambiarStockB.setText((double) cantCambiosB / cantReposiciones + "");
            txt_ProbCambiarStockC.setText((double) cantCambiosC / cantReposiciones + "");
        }
        if (cantPersonas != 0) {
            txt_ProbNoEncotrarGaseosaDeseada.setText((double) cantsinGaseosaDeseada / cantPersonas + "");
            txt_ProbIrseSinGaseosa.setText((double) cantSeFueron / cantPersonas + "");
        }
    }

    private void pintarTabla() {
        for (int i = 0; i < tabla.getRowCount(); i++) {
        }

    }
}
